#include "MefoolCaptureSettings.h"

#include <cmath>
#include <sstream>

namespace Mefool
{

CaptureSettings::CaptureSettings()
	: mImageFormat(),
	  mFrameRate(0)
{
}
CaptureSettings::CaptureSettings( const ImageFormat& imageFormat, float frameRate )
	: mImageFormat(imageFormat),
	  mFrameRate(frameRate)
{
}

bool CaptureSettings::operator==( const CaptureSettings& other ) const
{
	float sameFrameRate = fabs( mFrameRate - other.mFrameRate ) < 0.00001f;
	return	mImageFormat==other.mImageFormat && sameFrameRate;
}

std::string CaptureSettings::toString() const
{
	std::stringstream stream;
	stream << mImageFormat.toString() << ", " << mFrameRate << " frames/s";
	return stream.str();
}

}